package com.permission.model;

import com.fasterxml.jackson.annotation.*;
import com.solution.framework.model.BaseBean;
import org.hibernate.annotations.ForeignKey;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import javax.persistence.*;

/**
* Created with generator tools.
* User: sunguangzhu
* DateTime:2014-04-28 09:39:14
*/
@Entity
@Table(name = "t_p_user_role")
public class PUserRole extends BaseBean implements java.io.Serializable {

/**
* 归属用户
*/
private  com.permission.model.PUser pUser;

/**
* 归属角色
*/
private  com.permission.model.PRole pRole;

/** default constructor */
public PUserRole() {
}

/**
* full constructor
* @param pUser
* @param pRole
*/
public PUserRole( com.permission.model.PUser pUser, com.permission.model.PRole pRole) {
this.pUser=pUser;
this.pRole=pRole;
}

/**
*  getter
*/
    @JsonManagedReference
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "pUser_id")
    @NotFound(action = NotFoundAction.IGNORE)
    @ForeignKey(name = "fk_puserrole_pUser")
public  com.permission.model.PUser getPUser() {
return this.pUser;
}

/**
* setter
* @param pUser
*/
public void setPUser( com.permission.model.PUser pUser) {
this.pUser = pUser;
}

/**
*  getter
*/
    @JsonManagedReference
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "pRole_id")
    @NotFound(action = NotFoundAction.IGNORE)
    @ForeignKey(name = "fk_puserrole_pRole")
public  com.permission.model.PRole getPRole() {
return this.pRole;
}

/**
* setter
* @param pRole
*/
public void setPRole( com.permission.model.PRole pRole) {
this.pRole = pRole;
}

}
